import pandas as pd
import numpy as np

my_list=['算法','数据挖掘','图像']
input_file="./data4_1_classify_name/data4_1_old_data.xlsx"
data1=pd.read_excel(input_file)
data1=data1.values
for l in my_list:
    print("正在分离含有\"{}\"的".format(l)+"数据")
    output_file="./data4_1_classify_name/{}".format(l)+".xlsx"
    name=[]
    class1=[]
    sex=[]
    math=[]
    Chinese=[]
    for item in data1:
        if l in item[0]:
            name.append(item[0])
            class1.append(item[1])
            sex.append(item[2])
            math.append(item[3])
            Chinese.append(item[4])
    data2={"name":name,
           "class1":class1,
           "sex":sex,
           "math":math,
           "Chinese":Chinese}
    data2=pd.DataFrame(data2)
    data2.to_excel(output_file)
    print(data2)

